<#assign mid = param.arrayValue('mid')>
<#assign module_orl = param.arrayValue('module_orl')>
<#assign target_orl = param.arrayValue('target_orl')?if_exists>

<link rel="stylesheet" type="text/css" href="${MOD_FTL_MODULE_SKIN}/css/comment.css" />
<script type="text/javascript">

jQuery.comment._set_params = 'mid=${mid}&module_orl=${module_orl}';

function go_login() {
  jQuery.member.login();
}

jQuery(function() {

  <#if !MEI_GRANT_LOGIN>
  jQuery('#comment textarea').focus(function() {
    go_login();
  });
  </#if>

  jQuery(".btn_comment_add").mousedown(function() {
    jQuery(this).attr("src","${MOD_FTL_MODULE_SKIN}/images/btn_registry_down.gif");
  }).mouseup(function() { jQuery(this).attr("src","${MOD_FTL_MODULE_SKIN}/images/btn_registry.gif"); });

});

</script>

<div id="comment">

<div class="cb_module cb_fluid">
  <h5 class="cb_h_type cb_h_type2">댓글 <span>(<strong>${O.listComment?size?string(",###")}</strong>)</span></h5>

  <form id="form_comment_delete" method="post" action="procCommentDelete.me">
  </form>

  <div class="cb_lstcomment">
    <ul>

    <#list O.listComment as objComment>
    <#if objComment.reply_depth?number != 0>
    <li class="cb_thumb_off" id="comment_${objComment.comment_orl}" style="padding-left:10px;">
    <span class="cb_bu_subnode3">ㄴ</span>
    <#else>
    <li class="cb_thumb_off" id="comment_${objComment.comment_orl}">
    </#if>
      <div class="cb_comment_area">
        <a name="cmt_${objComment.comment_orl}"></a>
        <div class="cb_info_area">
          <div class="cb_section">
            <span class="cb_nick_name">${objComment.nickname}</span>
            <span class="cb_usr_id">(${objComment.user_id})</span>
            <span class="cb_date"><#if objComment.rdate?exists>${objComment.rdate?date("yyyyMMddHHmmss")?string("yyyy-MM-dd HH:mm")}</#if></span>
          </div>
          <div class="cb_section2">
            <span class="cb_nobar"><a class="c_reply_act" href="javascript:jQuery.comment.reply('${objComment.comment_orl}','${objComment.reply_group}','${objComment.reply_depth}','${objComment.reply_seq}');">답글</a></span>
            <#if objComment.is_mine><span class="cb_nobar"><a class="c_update_act" href="javascript:jQuery.comment.update('${objComment.comment_orl}');">수정</a></span><span class="cb_nobar"><a class="c_del_act" href="javascript:jQuery.comment.del('${objComment.comment_orl}');">삭제</a></span></#if>
          </div>
        </div>
        <div class="cb_dsc_comment">
          <p class="cb_dsc" id="c_content_${objComment.comment_orl}">${objComment.content?replace('\n','<br />')}</p>
        </div>
        <!-- 숨김처리
        <div class="cb_info_area2">
          <a href="#">3개</a>의 답글이 있습니다.
        </div>
        //숨김처리 -->
      </div>
    </li>
    </#list>

    </ul>
  </div>

  <div style="padding-top:15px;"></div>

  <!-- 입력 폼 -->
  <div class="cb_wrt cb_wrt_default">
    <div class="cb_wrt_box">
      <div class="cb_wrt_box2">
      <form id="form_comment" method="post" action="procCommentInsert.me">
      <input type="hidden" name="target_orl" id="target_orl" value="${target_orl}"/>
      <input type="hidden" name="parent_orl" id="parent_orl" value="0"/>
      <input type="hidden" name="reply_group" id="reply_group" value="0"/>
      <input type="hidden" name="reply_depth" id="reply_depth" value="0"/>
      <input type="hidden" name="reply_seq" id="reply_seq" value="0"/>
      <fieldset>
      <legend>등록 폼</legend>
        <div class="cb_usr_area">
          <div class="cb_txt_area">
            <table cellspacing="0" border="1" class="cb_section">
            <caption>덧글 입력박스</caption>
            <col><col width="90">
            <thead>
            <tr>
            <th colspan="2" scope="col">유동형 덧글모듈</th>
            </tr>
            </thead>
            <tbody>
            <tr>
            <td>
              <textarea name="content" id="content"><#if !MEI_GRANT_LOGIN>로그인 하셔야 댓글을 작성할 수 있습니다.</#if></textarea>
            </td>
            <td class="cb_btn_area"><a href="javascript:<#if MEI_GRANT_LOGIN>jQuery.comment.save('#form_comment');<#else>go_login();</#if>"><img src="${MOD_FTL_MODULE_SKIN}/images/btn_registry.gif" class="btn_comment_add"/></a></td>
            </tr>
            </tbody>
            </table>

          </div>
        </div>
      </fieldset>
      </form>
      </div>
    </div>
  </div>
  <!-- 입력 폼 -->

</div>

  <!-- 수정 폼 -->
  <div class="cb_wrt cb_wrt_default" id="comment_update" style="display:none;">
    <div class="cb_wrt_box">
      <div class="cb_wrt_box2">
      <form>
      <input type="hidden" name="comment_orl" id="comment_orl" />
      <fieldset>
      <legend>댓글 등록 폼</legend>
        <div class="cb_usr_area">
          <div class="cb_txt_area">
            <table cellspacing="0" border="1" class="cb_section">
            <caption>덧글 입력박스</caption>
            <col><col width="90">
            <thead>
            <tr>
            <th colspan="2" scope="col">유동형 덧글모듈</th>
            </tr>
            </thead>
            <tbody>
            <tr>
            <td>
              <textarea cols="80" rows="20" name="content" id="content"></textarea>
            </td>
            <td class="cb_btn_area">
              <img src="${MOD_FTL_MODULE_SKIN}/images/btn_registry.gif" id="update_btn" class="btn_comment_add" />
            </td>
            </tr>
            <tr>
            <td><div class="cb_dsc_area"><p class="cb_dsc cs-pointer cb_close" id="btn_comment_update_close">닫기</p></div></td>
            <td></td>
            </tr>
            </tbody>
            </table>

          </div>
        </div>
      </fieldset>
      </form>
      </div>
    </div>
  </div>
  <!-- 수정 폼 -->

<!-- 댓글 입력 폼 -->
<ul id="comment_reply" style="display:none;">
<li class="cb_thumb_off" style="padding-bottom:10px;">
<span class="cb_bu_subnode">ㄴ</span>

<div class="cb_wrt cb_wrt_default">
  <div class="cb_wrt_box">
    <div class="cb_wrt_box2">

    <form>
    <input type="hidden" name="target_orl" id="target_orl" value="${target_orl}"/>
    <input type="hidden" name="parent_orl" id="parent_orl" value="0"/>
    <input type="hidden" name="reply_group" id="reply_group" value="0"/>
    <input type="hidden" name="reply_depth" id="reply_depth" value="0"/>
    <input type="hidden" name="reply_seq" id="reply_seq" value="0"/>

    <fieldset>
    <legend>댓글 등록 폼</legend>
      <div class="cb_usr_area">
        <div class="cb_txt_area">

          <table cellspacing="0" border="1" class="cb_section">
          <caption>덧글 입력박스</caption>
          <col><col width="90">
          <thead>
          <tr>
          <th colspan="2" scope="col">유동형 덧글모듈</th>
          </tr>
          </thead>
          <tbody>
          <tr>
          <td>
            <textarea cols="80" rows="20" name="content" id="content"><#if !MEI_GRANT_LOGIN>로그인 하셔야 댓글을 작성할 수 있습니다.</#if></textarea>
          </td>
          <td class="cb_btn_area">
            <img src="${MOD_FTL_MODULE_SKIN}/images/btn_registry.gif" id="reply_btn" class="btn_comment_add" />
          </td>
          </tr>
          <tr>
          <td><div class="cb_dsc_area"><p class="cb_dsc cs-pointer cb_close" id="btn_comment_reply_close">닫기</p></div></td>
          <td></td>
          </tr>
          </tbody>
          </table>

        </div>
      </div>
    </fieldset>
    </form>
    </div>
  </div>
</div>

</li>
</ul>
<!-- 댓글 입력 폼 -->

</div>